package com.ewzj.bigdata.mvp.ui.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewzj.bigdata.R;
import com.ewzj.bigdata.mvp.model.entity.resbean.SearchResultBean;

import java.util.List;

/**
 * Author:zhangjing
 * Time:2018/4/3  下午3:26
 * Name: this is SearchAdapter
 * Email:zhangjingworkmol@163.com
 */

public class SearchAdapter extends BaseMultiItemQuickAdapter<SearchResultBean,BaseViewHolder>{
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    /**
     *
     * 0、搜索记录 1、搜索记录item 2、热门section 3、热门搜索
     */
    int TYPE_LEVEL_0=0;
    int TYPE_LEVEL_1=1;
    int TYPE_LEVEL_2=2;
    int TYPE_LEVEL_3=3;
    public SearchAdapter(List<SearchResultBean> data) {
        super(data);
        addItemType(TYPE_LEVEL_0, R.layout.item_search_record);
        addItemType(TYPE_LEVEL_1, R.layout.search_result_item);
        addItemType(TYPE_LEVEL_2, R.layout.item_search_hot);
        addItemType(TYPE_LEVEL_3, R.layout.search_hot_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchResultBean item) {
        TextView textView=helper.<TextView>getView(R.id.tv_tagname);
        if (textView!=null){
            textView.setText(item.getKeywords());
        }
        switch (helper.getItemViewType()){
            case 0:
                break;
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
        }
    }
}
